/* StringIdentifiers.java
 * 
 * Alfred Olschnoegger
 * 03.06.2008
 */

package technical.deParser;

/**
 * TODO description
 * 
 * @date 03.06.2008
 * @author Alfred Olschnoegger
 */

public class StringIdentifier {
	// instance
	private static StringIdentifier s_Instance;

	// parser settings
	private char m_RecordSeperator = ';';
	private char m_FieldSeperator = ',';
	private char m_SuccessValue = '+';
	private char m_ExceptionValue = '!';
	private char m_InformationValue = '#';
	private char m_DataValue = '%';

	private String m_RabbitIdent = "r";
	private String m_HunterIdent = "h";
	private String m_GameIdent = "g";
	private String m_AuthIdent = "auth";
	private String m_InfoIdent = "i";
	

	public static StringIdentifier getInstance() {
		if (s_Instance == null)
			s_Instance = new StringIdentifier();
		return s_Instance;
	}

	private StringIdentifier() {
	}

	public char getRecordSeperator() {
		return m_RecordSeperator;
	}

	public char getFieldSeperator() {
		return m_FieldSeperator;
	}

	public char getSuccessValue() {
		return m_SuccessValue;
	}

	public char getExceptionValue() {
		return m_ExceptionValue;
	}

	public char getInformationValue() {
		return m_InformationValue;
	}

	public String getRabbitIdent() {
		return m_RabbitIdent;
	}

	public String getHunterIdent() {
		return m_HunterIdent;
	}

	public String getGameIdent() {
		return m_GameIdent;
	}

	public String getAuthIdent() {
		return m_AuthIdent;
	}

	public char getDataValue() {
		return m_DataValue;
	}

	public boolean isIdentifier(char charAt) {
		if (charAt == m_DataValue || charAt == m_ExceptionValue || charAt == m_InformationValue || charAt == m_SuccessValue)
			return true;

		return false;
	}

	public String getInfoIdent() {
		return m_InfoIdent;
	}
	
	public String getExceptionClassName(int nr) {
		if(nr == 1)
			return "GameNotExistingException";
		
		if(nr == 2)
			return "GameEndedException";
		
		if(nr == 3)
			return "NotLoggedInException";
		
		if(nr == 4)
			return "UserAlreadyRegisteredException";
		
		if(nr == 5)
			return "HunterNotRegisteredException";
		
		if(nr == 6)
			return "ObjectNotFoundException";
		
		return null;
		
	}
	
	public String getObjectClassName(String identifier) {
		if(identifier.equals("r"))
			return "Rabbit";
		
		//FIXME powerups poweruppen
		if(identifier.equals("p"))
			return "powerup";
			
		return null;
		
	}
}

// end of StringIdentifiers.java
